import { freshType } from "../types";

type CardPropType = {
  title: string,
  freshes: freshType | undefined;
}


const Card = (props: CardPropType) => {
  const { freshes, title } = props
  return (
    <div className="card" >
      <h3 className='card-title'>
        <img
          className='card-title-img'
          src='http://statics.dell-lee.com/shopping/hot.png'
          alt={title} />
        {title}
        <div className="card-title-more" >
          更多
          <span className='iconfont'>&#xe614;</span>
        </div>
      </h3>
      <div className="card-content">
        {
          (freshes || []).map(item => {
            return (
              <div className="card-content-item" key={item.id}>
                <img
                  alt={item.name}
                  className='card-content-item-img'
                  src={item.imgUrl}
                />
                <p className='card-content-item-desc'>金锣 国产猪肉 去皮猪五花肉块 …</p>
                <div className='card-content-item-price'>
                  <span className='card-content-item-yen'>&yen;</span>
                  {item.price}
                  <div className='iconfont'>&#xe667;</div>
                </div>
              </div>
            )
          })
        }
      </div>
    </div >
  )
}

export default Card